//
//  UserTool.m
//  CMJWeibo
//
//  Created by BH on 15/12/11.
//
//

#import "UserTool.h"
#import "HttpTool.h"
#import "MJExtension.h"

@implementation UserTool

+(void)getUnreadCountWithParam:(UnreadCountParam *)param success:(void (^)(UnreadCountResult *))success failure:(void (^)(NSError *))failure
{
    [HttpTool getWithURL:@"https://rm.api.weibo.com/2/remind/unread_count.json" params:param.keyValues success:^(id json) {
        if (success) {
            //字典转模型
            UnreadCountResult *result = [UnreadCountResult objectWithKeyValues:json];
            success(result);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}

+(void)getUserInfoWithParam:(UserInfoParam *)param success:(void (^)(UserInfoResult *))success failure:(void (^)(NSError *))failure
{
    [HttpTool getWithURL:@"https://api.weibo.com/2/users/show.json" params:param.keyValues success:^(id json) {
        
        if (success) {
            UserInfoResult *result = [UserInfoResult objectWithKeyValues:json];
            success(result);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}

@end
